
# 导入redis模块
from redis import StrictRedis


class Config():
    DEBUG = None
    # 配置密钥
    SECRET_KEY = 'rMlmlHmW7p78UfuuiS6HJ3sGf9dS36lnCdUY6LIAyVt/TNnjL7bpWIctW'
    # 配置mysql的链接
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@localhost/info33'
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # 封装reids的主机和端口号
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379
    # 设置session信息存储在redis中
    SESSION_TYPE = 'redis'
    SESSION_REDIS = StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    SESSION_USE_SIGNER = True  # SESSION信息签名
    PERMANENT_SESSION_LIFETIME = 86400


# 定义开发模式下的类
class DevelopmentConfig(Config):
    DEBUG = True

# 定义生产模式下的类
class ProductionConfig(Config):
    DEBUG = False

# 定义字典映射不同环境
config_dict = {
    'development':DevelopmentConfig,
    'production':ProductionConfig
}